import socket


def main():

    # 创建套接字
    s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

    # 绑定ip 
    s.bind(("",7788))

    send_data = input("发送的数据:")
    # 发送数据
    s.sendto(send_data.encode("utf-8"),("192.168.0.11",8080))

    # 接受数据
    request = s.recvfrom(1024)

    print(request[0].decode('gbk'))
    print(request[1][0])
    print(request[1][1])

    # 关闭 套接字
    s.close()


if __name__ == "__main__":
    main()